﻿using Serilog;
using Serilog.Events;

namespace ConsoleApp3
{
    internal class Program
    {
        //Serilog 支持过滤器来控制日志输出。下面的示例演示了如何使用过滤器来仅输出错误级别以上的日志：
        //Filter.ByIncludingOnly：是包括
        //Filter.ByExcluding:是不包括
        static void Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
              .MinimumLevel.Debug()
              .WriteTo.Console()
              .Filter.ByIncludingOnly(logEvent => logEvent.Level >= LogEventLevel.Error)
              .CreateLogger();

            Log.Verbose("This is a verbose log message.");
            Log.Debug("This is a debug log message.");
            Log.Information("This is an informational log message.");
            Log.Warning("This is a warning log message.");
            Log.Error("This is an error log message.");
            Log.Fatal("This is a fatal log message.");

            Log.CloseAndFlush();
        }
    }
}
